package cn.cjp.m3d22;

public class Hero {

    private String name;
    //类作为成员变量
    private Weapon weapon;

        //接口作为成员变量
    private Skill skill;

    public Hero(String name, Weapon weapon, Skill skill) {
        this.name = name;
        this.weapon = weapon;
        this.skill = skill;
    }

    public void method1(){
        skill.use();
    }

    public Skill getSkill() {
        return skill;
    }

    public void setSkill(Skill skill) {
        this.skill = skill;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Weapon getWeapon() {
        return weapon;
    }

    public void setWeapon(Weapon weapon) {
        this.weapon = weapon;
    }

    public Hero(String name, Weapon weapon) {
        this.name = name;
        this.weapon = weapon;
    }

    public Hero() {
    }
}
